#include <bits/stdc++.h>

using namespace std;


int main()
{
    int n, v, m, a;
    while (cin >> n >> v >> m >> a)
    {
        // int an = v + (n-1)*a;
        // int sn = (n * (v + an)) / 2;
        // cout << sn << endl;
        //一共会提升多少次价格
        int level = n % m == 0 ? n / m : n / m + 1;
        int sum = 0;
        //对每个价格区间直接求和
        for (int i = 0; i < level; i++)
        {
            if (n % m == 0)
                sum += m * (v + (a * i));
            else
            {
                if (i == level - 1)
                {
                    sum += (n % m) * (v + (a * i));
                }
                else
                {
                    sum += m * (v + (a * i));
                }
            }
        }
        cout << sum << endl;
    }
    return 0;
}